package texture;


import org.lwjgl.opengl.GL11;


public class Texture {
    /** The GL target type */
    private int target; 
    /** The GL texture ID */
    private int textureID;
    /** The height of the image */
    private int height;
    /** The width of the image */
    private int width;
    /** The width of the texture */
    private int texWidth;
    /** The height of the texture */
    private int texHeight;
    /** The ratio of the width of the image to the texture */
    private float widthRatio;
    /** The ratio of the height of the image to the texture */
    private float heightRatio;
    
   
    public Texture(int target,int textureID) {
        this.target = target;
        this.textureID = textureID;
    }
    
    /* Bind GL Context to Texture */
    public void bind() {
    	GL11.glBindTexture(target, textureID);
    }
    
    /* Set height of image */
    public void setHeight(int height) {
        this.height = height;
        setHeight();
    }
    
    /* Set width of image */
    public void setWidth(int width) {
        this.width = width;
        setWidth();
    }
    
    /* Return height of image */
    public int getImageHeight() {
        return height;
    }
    
    /* Return width of image */
    public int getImageWidth() {
        return width;
    }
    
    /* Return height of image */
    public float getHeight() {
        return heightRatio;
    }
    
    /* Return width of image */
    public float getWidth() {
        return widthRatio;
    }
    
    /* Set height of texture */
    public void setTextureHeight(int texHeight) {
        this.texHeight = texHeight;
        setHeight();
    }
    
    /* Set width of texture */
    public void setTextureWidth(int texWidth) {
        this.texWidth = texWidth;
        setWidth();
    }
    
    /* Set height of image */
    private void setHeight() {
        if (texHeight != 0) {
            heightRatio = ((float) height)/texHeight;
        }
    }
    
    /* Set width of image */
    private void setWidth() {
        if (texWidth != 0) {
            widthRatio = ((float) width)/texWidth;
        }
    }
    public int getTexureID(){
    	return textureID;
    }
    
}

    
    